package com.yaorange.nongit.service.impl;

import java.util.List;
import com.yaorange.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yaorange.nongit.mapper.NjtUserPerfectMapper;
import com.yaorange.nongit.domain.NjtUserPerfect;
import com.yaorange.nongit.service.INjtUserPerfectService;

/**
 * ⽤户完善信息Service业务层处理
 * 
 * @author lzh
 * @date 2025-02-27
 */
@Service
public class NjtUserPerfectServiceImpl implements INjtUserPerfectService 
{
    @Autowired
    private NjtUserPerfectMapper njtUserPerfectMapper;


    /**
     * 根据⽤户注册id查询会员完善信息
     *
     * @param userId
     * @return
     */
    @Override
    public NjtUserPerfect getByRegisterUserId(Long userId) {
        NjtUserPerfect query = new NjtUserPerfect();
        query.setUserId(userId);
        List<NjtUserPerfect> njtUserPerfects = selectNjtUserPerfectList(query);
        if (null != njtUserPerfects && !njtUserPerfects.isEmpty()) {
            return njtUserPerfects.get(0);
        }
        return null;
    }

    /**
     * 查询⽤户完善信息
     * 
     * @param id ⽤户完善信息主键
     * @return ⽤户完善信息
     */
    @Override
    public NjtUserPerfect selectNjtUserPerfectById(Long id)
    {
        return njtUserPerfectMapper.selectNjtUserPerfectById(id);
    }

    /**
     * 查询⽤户完善信息列表
     * 
     * @param njtUserPerfect ⽤户完善信息
     * @return ⽤户完善信息
     */
    @Override
    public List<NjtUserPerfect> selectNjtUserPerfectList(NjtUserPerfect njtUserPerfect)
    {
        return njtUserPerfectMapper.selectNjtUserPerfectList(njtUserPerfect);
    }

    /**
     * 新增⽤户完善信息
     * 
     * @param njtUserPerfect ⽤户完善信息
     * @return 结果
     */
    @Override
    public int insertNjtUserPerfect(NjtUserPerfect njtUserPerfect)
    {
        njtUserPerfect.setCreateTime(DateUtils.getNowDate());
        return njtUserPerfectMapper.insertNjtUserPerfect(njtUserPerfect);
    }

    /**
     * 修改⽤户完善信息
     * 
     * @param njtUserPerfect ⽤户完善信息
     * @return 结果
     */
    @Override
    public int updateNjtUserPerfect(NjtUserPerfect njtUserPerfect)
    {
        njtUserPerfect.setUpdateTime(DateUtils.getNowDate());
        return njtUserPerfectMapper.updateNjtUserPerfect(njtUserPerfect);
    }

    /**
     * 批量删除⽤户完善信息
     * 
     * @param ids 需要删除的⽤户完善信息主键
     * @return 结果
     */
    @Override
    public int deleteNjtUserPerfectByIds(Long[] ids)
    {
        return njtUserPerfectMapper.deleteNjtUserPerfectByIds(ids);
    }

    /**
     * 删除⽤户完善信息信息
     * 
     * @param id ⽤户完善信息主键
     * @return 结果
     */
    @Override
    public int deleteNjtUserPerfectById(Long id)
    {
        return njtUserPerfectMapper.deleteNjtUserPerfectById(id);
    }
}
